<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<div th:replace="common/header::header('考生信息更新')"></div>
<script>
    function getAreaList() {
        $.ajax({
            type: "post",
            url: "/erems/admin/areaList",    //url根据自己的项目实际定义
            async: false,
            dataType: "text",
            error: function () {
                alert("系统忙，请稍后再试！");
                return false;
            },
            success: function (text) {
                var expressExam = $("#addressId");
                var str = '';
                var data = eval("(" + text + ")");
                var tid=expressExam.attr("value");
                expressExam.empty();
                console.log(tid)
                for (var o in data) {
                    if(tid==data[o].id) {
                        str += '<option value="' + data[o].id + '" selected>' + data[o].province + data[o].city + '</option>';
                    }else{
                        str += '<option value="' + data[o].id + '">' + data[o].province + data[o].city + '</option>';
                    }
                }
                expressExam.append(str);
            }
        });
    }
</script>
<body onload="getAreaList()">
<div id="wrapper" class="row">
    <div th:replace="common/header::nav"></div>
    <div id="page-inner">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        考生信息表
                    </div>
                    <div class="panel-body">
                        <form th:action="'/erems/manager/saveInfo'" method="post">
                            <input type="hidden" id="sname" name="sname" th:value="${sname}"/>
                            <input type="hidden" id="sexam" name="sexam" th:value="${sexam}"/>
                        <div class="table-responsive">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th style="width:40%;"></th>
                                    <th>信息</th>
                                </tr>
                                </thead>
                                <tbody th:object="${examinee}">
                                <tr>
                                    <td>姓名</td>
                                    <td>
                                        <input type="text" id="name" name="name" class="required" placeholder="姓名"
                                               value="无" th:value="*{name}"/>
                                        <input type="hidden" id="id" name="id" th:value="*{id}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>用户名</td>
                                    <td th:text="*{username}">zrq</td>
                                </tr>
                                <tr>
                                    <td>性别</td>
                                    <td>
                                        <input type="text" id="sex" name="sex" class="required" placeholder="性别"
                                               value="无" th:value="*{sex}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>邮箱</td>
                                    <td>
                                        <input type="text" id="email" name="email" class="required" placeholder="邮箱"
                                               value="无" th:value="*{email}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>电话</td>
                                    <td>
                                        <input type="text" id="phone" name="phone" class="required" placeholder="电话"
                                               value="0" th:value="*{phone}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>身份证号</td>
                                    <td>
                                        <input type="text" id="idnumber" name="idnumber" class="required" placeholder="身份证号"
                                               value="0" th:value="*{idnumber}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>教育背景</td>
                                    <td>
                                        <input type="text" id="eduback" name="eduback" class="required" placeholder="教育背景"
                                               value="无" th:value="*{eduback}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>地址</td>
                                    <td>
                                        <select id="addressId" name="address.id" th:value="*{address.id}"  th:text="*{address.province+address.city}">
                                            <option>全部</option>
                                        </select>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <button type="submit" class="btn btn-primary">保存</button>
                            <button class="btn btn-warning">
                                <a href="javascript:history.go(-1)" style="color:white;">取消</a>
                            </button>
                        </div>
                        </form>
                    </div>
                </div>
        </div>
        </div>
        <!-- /. ROW  -->
    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- /. WRAPPER  -->

<div th:replace="common/footer"></div>
</body>
</html>